package com.cx330;

/**
 * JDK21语法结构
 */
public class Example16 {
    public static void main(String[] args) {
        Object[] arr = {"hello", 8, 3.1415926};
        for (int i = 0; i < arr.length; i++) {
//            switch (arr[i]) {
//                case String str -> System.out.println(str + "首字母：" + str.charAt(0));
//                case Integer integer -> System.out.println(integer + "是" + (integer % 2 == 0 ? "偶数" : "奇数"));
//                case Double num -> System.out.println("%f保留小数点后2位%.2f", num, num);
//                default -> throw new RuntimeException();
//            }
        }
    }
}
